import Controller.UserController;
import Dao.daoImpl.DBUtils;
import Model.Login;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Scanner;

public class RunEmp {
    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner();
        System.out.println("-------欢迎使用员工管理系统--------");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入user");
        String user = scanner.next();
        System.out.println("请输入password");
        String password = scanner.next();

        Login login = queryRunner.query(DBUtils.getConnection(),
                "select * from login where user=? and password=?",
                new BeanHandler<Login>(Login.class), user, password);
        System.out.println("logins = " + login);
        if (login == null) {
            System.out.println("no");
        } else {
            UserController userController = new UserController();
            userController.userServiceResquest();
        }
    }
}

